{% extends 'base_with_top_menu.html' %}

{% load go_back_link %}

{% block title %}List of sent emails{% endblock %}

{% block header %}List of sent emails{% endblock %}

{% block content %}
    {% if display_tips %}
    <div class="tip">
      <ol>
        <li><p>For some events only mails are sent. They are: book reserving and book renting. Others will be added soon (just a matter of time).</p></li>
        <li><p>Email body may differ (but not significantly) from the one that was sent. Why? Because to display the body <a href="http://docs.djangoproject.com/en/dev/ref/templates/builtins/#linebreaks">django's linebreaks tag</a> was used.</p></li>
        <li><p>Known bug: reservation confirmation email says 'Come & rent' even if book is not rentable (i.e. it's unavailable).</p></li>
      </ol>
    </div>
    {% endif %}

    <div class="emails_wrapper">
      {% if emails %}
      <table class="emails">
        <tbody>
          <tr><th>Sent date</th> <th>From</th> <th>To</th> <th>Body</th> </tr>
          {% for email in emails %}
          <tr><td>{{email.sent_date|date:"d.m.Y H:i"}}</td> <td>{{email.sender}}</td> <td>{{email.receiver}}</td> <td>{{email.body|linebreaks}}</td> </tr>
          {% endfor %}
        </tbody>
      </table>
      {% else %}
      <p>No email logs -- log is empty.</p>
      {% endif %}
    </div>
{% endblock %}
